{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Numpy 常用功能\n",
    "\n",
    "首先一定要记住一点，Numpy 是列向量优先的，也就是说**一维数组就是列向量！转置后才是行向量**！\n",
    "一维向量的索引是「行」，因此 Numpy 的默认索引是行索引（`axis=0`）\n",
    "\n",
    ">https://www.datacamp.com/cheat-sheet/numpy-cheat-sheet-data-analysis-in-python\n",
    "\n",
    "![](./_img/numpy-cheat-sheet.webp)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[[ 0,  1,  2],\n",
       "        [ 3,  4,  5],\n",
       "        [ 6,  7,  8]],\n",
       "\n",
       "       [[ 9, 10, 11],\n",
       "        [12, 13, 14],\n",
       "        [15, 16, 17]],\n",
       "\n",
       "       [[18, 19, 20],\n",
       "        [21, 22, 23],\n",
       "        [24, 25, 26]]])"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "\n",
    "# 1. 数组\n",
    "## 数组可以有任意个维度（0 - 任意正整数），常用 1 - 3 维\n",
    "## 一个三维数组如下：\n",
    "a1 = np.arange(27).reshape((3,3,3))\n",
    "a1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "13"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 2. 索引\n",
    "## axis=0 行方向\n",
    "## axis=1 列方向\n",
    "## axis=2 第三个维度，可以理解为跟屏幕垂直的方向\n",
    "a1[1,1,1]  # 三个维度索引都为 1，即 3*3*3 的数组中最中心的数字"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
  },
  "kernelspec": {
   "display_name": "Python 3.9.12 64-bit",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
